package com.example.calculatorApp.controller.request;

import com.example.calculatorApp.common.Result;
import com.example.calculatorApp.entity.Admin;
import com.example.calculatorApp.service.IAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin")
public class AdminController {

    @Autowired
    IAdminService IAdminService;

    @PostMapping("/login")
    public Result login(@RequestBody LoginRequest loginRequest){
        return (Result) IAdminService.login(loginRequest);
    }

    @GetMapping("/{id}")
    public Result getById(@PathVariable Integer id){
        Admin admin= IAdminService.getById(id);
        Result info = Result.success(admin);
        return  info;
}
}
